home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / CHIP 2005-06.iso / program / e-is / OOo_2.0beta_tr_TR_WinIntel / openofficeorg2.cab / ooo2spreadsheetml.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-03-16  |  10.9 KB  |  243 lines

  1. ∩╗┐<?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.    $RCSfile: ooo2spreadsheetml.xsl,v $
  5.  
  6.    $Revision: 1.4 $
  7.  
  8.    last change: $Author: rt $ $Date: 2005/01/28 15:22:35 $
  9.  
  10.    The Contents of this file are made available subject to the terms of
  11.    either of the following licenses
  12.  
  13.           - GNU Lesser General Public License Version 2.1
  14.           - Sun Industry Standards Source License Version 1.1
  15.  
  16.    Sun Microsystems Inc., October, 2000
  17.  
  18.    GNU Lesser General Public License Version 2.1
  19.    =============================================
  20.    Copyright 2000 by Sun Microsystems, Inc.
  21.    901 San Antonio Road, Palo Alto, CA 94303, USA
  22.  
  23.    This library is free software; you can redistribute it and/or
  24.    modify it under the terms of the GNU Lesser General Public
  25.    License version 2.1, as published by the Free Software Foundation.
  26.  
  27.    This library is distributed in the hope that it will be useful,
  28.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30.    Lesser General Public License for more details.
  31.  
  32.    You should have received a copy of the GNU Lesser General Public
  33.    License along with this library; if not, write to the Free Software
  34.    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35.    MA  02111-1307  USA
  36.  
  37.  
  38.    Sun Industry Standards Source License Version 1.1
  39.    =================================================
  40.    The contents of this file are subject to the Sun Industry Standards
  41.    Source License Version 1.1 (the "License"); You may not use this file
  42.    except in compliance with the License. You may obtain a copy of the
  43.    License at http://www.openoffice.org/license.html.
  44.  
  45.    Software provided under this License is provided on an "AS IS" basis,
  46.    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47.    WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48.    MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49.    See the License for the specific provisions governing your rights and
  50.    obligations concerning the Software.
  51.  
  52.    The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  53.  
  54.    Copyright ┬⌐ 2002 by Sun Microsystems, Inc.
  55.  
  56.    All Rights Reserved.
  57.  
  58.    Contributor(s): _______________________________________
  59.  
  60. -->
  61.  
  62. <xsl:stylesheet version="1.0"
  63.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  64.     xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
  65.     xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0"
  66.     xmlns:dc="http://purl.org/dc/elements/1.1/"
  67.     xmlns:dom="http://www.w3.org/2001/xml-events"
  68.     xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
  69.     xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
  70.     xmlns:fo="http://www.w3.org/1999/XSL/Format"
  71.     xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
  72.     xmlns:math="http://www.w3.org/1998/Math/MathML"
  73.     xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
  74.     xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
  75.     xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
  76.     xmlns:ooo="http://openoffice.org/2004/office"
  77.     xmlns:oooc="http://openoffice.org/2004/calc"
  78.     xmlns:ooow="http://openoffice.org/2004/writer"
  79.     xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
  80.     xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
  81.     xmlns:svg="http://www.w3.org/2000/svg"
  82.     xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
  83.     xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
  84.     xmlns:xlink="http://www.w3.org/1999/xlink"
  85.     xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  86.     exclude-result-prefixes="chart config dc dom dr3d draw fo form math meta number office ooo oooc ooow script style svg table text xlink">
  87.  
  88.  
  89.     <!--+++++ INCLUDED XSL MODULES +++++-->
  90.  
  91.     <!-- helper collection, to convert measures (e.g. inch to pixel using DPI (dots per inch) parameter)-->
  92.     <xsl:import  href="../../common/measure_conversion.xsl" />
  93.  
  94.     <!-- excel table handling -->
  95.     <xsl:include  href="table.xsl" />
  96.  
  97.     <!-- mapping rules of office style properties to Excel style properties -->
  98.     <xsl:include href="style_mapping.xsl" />
  99.  
  100.     <!-- creating the Excel styles element  -->
  101.     <xsl:include href="styles.xsl" />
  102.  
  103.     <xsl:output method               = "xml"
  104.                 indent               = "no"
  105.                 encoding             = "UTF-8"
  106.                 omit-xml-declaration = "no" />
  107.  
  108.     <xsl:strip-space elements="ss:Data html:Data" />
  109.  
  110.  
  111.     <!-- common table handling -->
  112.     <xsl:variable name="namespace" select="'urn:schemas-microsoft-com:office:spreadsheet'" />
  113.  
  114.     <!--+++++ PARAMETER SECTION +++++-->
  115.  
  116.     <!-- OPTIONAL: (MANDATORY: for all input document with relative external links): parameter is a (relative) URL to the target directory.
  117.          Relative links from the office document (e.g. to external graphics) will get this parameter as a prefix -->
  118.     <xsl:param name="targetBaseURL" select="'./'" />
  119.  
  120.     <!-- OPTIONAL: (MANDATORY: for input document with relative internal links)
  121.          To access contents of a office file (content like the meta.xml, styles.xml file or  graphics) a URL could be choosen.
  122.      This could be even a JAR URL. The sourceBase of the content URL "jar:file:/C:/temp/Test.sxw!/content.xml" would be
  123.      "jar:file:/C:/temp/Test.sxw!/" for example.
  124.          When working with OpenOffice API a Package-URL encoded over HTTP can be used to access the jared contents of the the jared document. -->
  125.     <xsl:param name="sourceBaseURL" select="'./'" />
  126.  
  127.     <!-- OPTIONAL: (MANDATORY: for session management by URL rewriting)
  128.          Useful for WebApplications: if a HTTP session is not cookie based, URL rewriting is beeing used (the session is appended to the URL).
  129.          This URL session is used for example when links to graphics are created by XSLT. Otherwise the user havt to log again in for every graphic he liks to see. -->
  130.     <xsl:param name="optionalURLSuffix" />
  131.  
  132.     <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
  133.     <xsl:param name="metaFileURL" />
  134.  
  135.     <!-- OPTIONAL: URL to office meta file (flat xml use the URL to the input file) -->
  136.     <xsl:param name="stylesFileURL" />
  137.  
  138.     <!-- OPTIONAL: in case of using a different processor than a JAVA XSLT, you can unable the Java functionality
  139.          (e.g. encoding chapter names for the content-table as href and anchors ) -->
  140.     <xsl:param name="java"        select="true()" />
  141.     <xsl:param name="javaEnabled" select="boolean($java)" />
  142.  
  143.     <!-- OPTIONAL: for activating the debug mode set the variable here to 'true()' or give any value from outside -->
  144.     <xsl:param name="debug"                    select="false()" />
  145.     <xsl:param name="debugEnabled"             select="boolean($debug)" />
  146.  
  147.  
  148.     <!-- *************************** -->
  149.     <!-- *** Built up Excel file *** -->
  150.     <!-- *************************** -->
  151.  
  152.     <xsl:template match="/">
  153.  
  154.         <xsl:processing-instruction  name="mso-application">progid="Excel.Sheet"</xsl:processing-instruction>
  155.         <!-- Note: for debugging purpose include schema location
  156.         <Workbook xsi:schemaLocation="urn:schemas-microsoft-com:office:spreadsheet <YOUR_SCHEMA_URL>/excelss.xsd"> -->
  157.         <Workbook>
  158.             <!-- adding some default settings -->
  159.             <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
  160.                 <DownloadComponents/>
  161.             </OfficeDocumentSettings>
  162.             <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  163.                 <WindowHeight>9000</WindowHeight>
  164.                 <WindowWidth>13860</WindowWidth>
  165.                 <WindowTopX>240</WindowTopX>
  166.                 <WindowTopY>75</WindowTopY>
  167.                 <ProtectStructure>False</ProtectStructure>
  168.                 <ProtectWindows>False</ProtectWindows>
  169.             </ExcelWorkbook>
  170.             <!-- Note: the following handling will exchange the default, later
  171.                 <x:ExcelWorkbook>
  172.                     <xsl:apply-templates select="table:calculation-settings" />
  173.                 </x:ExcelWorkbook>
  174.             -->
  175.             <xsl:element name="Styles">
  176.                 <!-- our application default will not be used for export to Excel
  177.                 <xsl:apply-templates select="/*/office:styles/style:default-style" mode="styles" />-->
  178.                 <xsl:apply-templates select="/*/office:styles/style:style" mode="styles" />
  179.                 <xsl:apply-templates select="/*/office:automatic-styles/style:style" mode="styles" >
  180.                     <xsl:with-param name="isAutomatic" select="true()" />
  181.                 </xsl:apply-templates>
  182.             </xsl:element>
  183.             <xsl:apply-templates select="/*/office:body" />
  184.         </Workbook>
  185.     </xsl:template>
  186.  
  187.     <xsl:template match="office:body">
  188.         <!-- office:body table:table children are spreadsheets -->
  189.         <xsl:apply-templates />
  190.     </xsl:template>
  191.  
  192.     <xsl:template match="office:spreadsheet">
  193.         <xsl:apply-templates />
  194.     </xsl:template>
  195.  
  196.     <!-- Disable default element matching
  197.     <xsl:template match="*" />
  198.     -->
  199.  
  200.     <!-- office:body table:table children are spreadsheets -->
  201.     <xsl:template match="office:spreadsheet/table:table">
  202.         <xsl:element name="Worksheet">
  203.             <xsl:attribute name="ss:Name">
  204.                 <xsl:value-of select="@table:name" />
  205.             </xsl:attribute>
  206.             <xsl:call-template name="table:table" />
  207.         </xsl:element>
  208.     </xsl:template>
  209.  
  210.     <xsl:template match="table:decls" mode="ExcelWorkbook">
  211.         <xsl:apply-templates mode="ExcelWorkbook" />
  212.     </xsl:template>
  213.  
  214.     <xsl:template match="table:calculation-settings"  mode="ExcelWorkbook">
  215.         <xsl:if test="table:precision-as-shown">
  216.             <x:PrecisionAsDisplayed/>
  217.         </xsl:if>
  218.         <xsl:if test="table:null-date/@office:date-value='1904-01-01'">
  219.             <x:Date1904/>
  220.         </xsl:if>
  221.         <xsl:apply-templates select="table:iteration" />
  222.     </xsl:template>
  223.  
  224.     <xsl:template match="table:iteration" mode="ExcelWorkbook">
  225.         <xsl:element name="x:ExcelWorkbook">
  226.             <xsl:if test="@table:status = 'enable'">
  227.                 <x:Iteration/>
  228.             </xsl:if>
  229.             <xsl:if test="@table:steps">
  230.                 <xsl:element name="x:MaxIterations">
  231.                     <xsl:value-of select="@table:steps" />
  232.                 </xsl:element>
  233.             </xsl:if>
  234.             <xsl:if test="@table:maximum-difference">
  235.                 <xsl:element name="x:MaxChange">
  236.                     <xsl:value-of select="@table:maximum-difference" />
  237.                 </xsl:element>
  238.             </xsl:if>
  239.         </xsl:element>
  240.     </xsl:template>
  241.  
  242. </xsl:stylesheet>
  243.